package com.flask.colorpicker.cameralibrary.state;

import com.flask.colorpicker.cameralibrary.CameraInterface;
import com.flask.colorpicker.cameralibrary.JCameraView;

import ohos.agp.graphics.SurfaceOps;

/**
 * Borrow Picture State
 */
public class BorrowPictureState implements State {
    private final CameraMachine mMachine;

    public BorrowPictureState(CameraMachine machine) {
        this.mMachine = machine;
    }

    /**
     * start
     *
     * @param holder holder
     * @param screenProp screenProp
     */
    @Override
    public void start(SurfaceOps holder, float screenProp) {
        CameraInterface.getInstance().doStartPreview(holder, screenProp);
        mMachine.setState(mMachine.getPreviewState());
    }

    @Override
    public void stop() {}

    @Override
    public void focus(float x, float y) {}

    @Override
    public void switchCamera(SurfaceOps holder, float screenProp) {}

    @Override
    public void restart() {}

    @Override
    public void capture() {}

    @Override
    public void record() {}

    @Override
    public void stopRecord(boolean isShort, long time) {}

    /**
     * cancel
     *
     * @param holder holder
     * @param screenProp screenProp
     */
    @Override
    public void cancel(SurfaceOps holder, float screenProp) {
        CameraInterface.getInstance().doStartPreview(holder, screenProp);
        mMachine.getView().resetState(JCameraView.TYPE_PICTURE);
        mMachine.setState(mMachine.getPreviewState());
    }

    /**
     * confirm
     */
    @Override
    public void confirm() {
        mMachine.getView().confirmState(JCameraView.TYPE_PICTURE);
        mMachine.setState(mMachine.getPreviewState());
    }

    /**
     * zoom
     *
     * @param zoom zoom
     * @param type type
     */
    @Override
    public void zoom(float zoom, int type) {}

    /**
     * flash
     *
     * @param mode mode
     */
    @Override
    public void flash(int mode) {}
}
